//Project 3 - CS 3451 - Labyrinth Lite
//Instructor: Jarek Rossignac
//Author: Tyler Powell
//Date: September 2011

int ballRadius = 10;
final int BALLMINRADIUS = 5;
final int BALLMAXRADIUS = 15;
pt ballLocation = new pt(-width,-height);

void placeBall(float x, float y){ //put ball somewhere
  ballLocation = new pt(x,y);
}

void placeBall(pt p) { //put ball at some point
  ballLocation = p;
}

void incrementBallSize() {
  if(ballRadius < BALLMAXRADIUS){
    ballRadius++;
  } else {
    ballRadius = BALLMINRADIUS;
  }
}

void decrementBallSize() {
  if(ballRadius > BALLMINRADIUS){
    ballRadius--;
  } else {
    ballRadius = BALLMAXRADIUS;
  }
}

void drawBall(boolean threeD){ //draw the ball, different for 2d and 3d
  pushMatrix();
  
  fill(color(63,20,150));
  if(threeD) {
    rotateX(angleOfRotationX);
    rotateY(angleOfRotationY);
    translate(ballLocation.x-width/2,ballLocation.y-height/2,0);
    sphere(ballRadius);
  } else {
    translate(ballLocation.x,ballLocation.y);
    stroke(color(63,20,150));
    ellipse(0,0,ballRadius,ballRadius);
    noStroke();
  }
  noFill();
  popMatrix();
}
